package com.xs.designpattern;

import lombok.RequiredArgsConstructor;

/**
 * 加法表达式
 * @author xs
 */
@RequiredArgsConstructor
public class PlusExpression extends Expression {
    private final Expression leftExpression;
    private final Expression rightExpression;

    @Override
    public int interpret() {
        return leftExpression.interpret() + rightExpression.interpret();
    }

    @Override
    public String toString() {
        return "+";
    }
}
